<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>类声明</title>
</head>

<body>

  <script>
    function Phone(brand, price) {
      this.brand = brand;
      this.price = price;
    }

    Phone.prototype.call = function () {
      console.log('我可以打电话');
    }

    const Huawei = new Phone('华为', 3999);
    Huawei.call();
    console.log(Huawei)

    class Shouji {
      // 构造方法
      constructor(brand, price) {
        this.brand = brand;
        this.price = price;
      }
      call() {
        console.log("我可以打电话")
      }
    }

    const onePlus = new Shouji('1+', 1999);
    onePlus.call();
    console.log(onePlus)
  </script>
</body>

</html>